core: Delete some dead utility code
authorColin Walters <walters@verbum.org>
Sat, 3 Dec 2011 00:54:53 +0000 (19:54 -0500)
committerColin Walters <walters@verbum.org>
Sat, 3 Dec 2011 00:54:53 +0000 (19:54 -0500)
src/libotutil/ot-unix-utils.c
src/libotutil/ot-unix-utils.h

index 444f62070ffcbb39b4bd2e82a421bc2b7ef85ea6..2e4eaae4255aff1b03906e761f5174e4a7ae46a8 100644 (file)
@@ -106,21 +106,6 @@ ot_util_sort_filenames_by_component_length (GPtrArray *files)
   return array;
 }
 
-int
-ot_util_count_filename_components (const char *path)
-{
-  int i = 0;
-
-  while (path)
-    {
-      i++;
-      path = strchr (path, '/');
-      if (path)
-        path++;
-    }
-  return i;
-}
-
 gboolean
 ot_util_filename_has_dotdot (const char *path)
 {
@@ -237,51 +222,6 @@ ot_util_set_error_from_errno (GError **error,
   errno = saved_errno;
 }
 
-int
-ot_util_open_file_read (const char *path, GError **error)
-{
-  char *dirname = NULL;
-  char *basename = NULL;
-  DIR *dir = NULL;
-  int fd = -1;
-
-  dirname = g_path_get_dirname (path);
-  basename = g_path_get_basename (path);
-  dir = opendir (dirname);
-  if (dir == NULL)
-    {
-      ot_util_set_error_from_errno (error, errno);
-      goto out;
-    }
-
-  fd = ot_util_open_file_read_at (dirfd (dir), basename, error);
-
- out:
-  g_free (basename);
-  g_free (dirname);
-  if (dir != NULL)
-    closedir (dir);
-  return fd;
-}
-
-int
-ot_util_open_file_read_at (int dirfd, const char *name, GError **error)
-{
-  int fd;
-  int flags = O_RDONLY;
-  
-#ifdef O_CLOEXEC
-  flags |= O_CLOEXEC;
-#endif
-#ifdef O_NOATIME
-  flags |= O_NOATIME;
-#endif
-  fd = openat (dirfd, name, flags);
-  if (fd < 0)
-    ot_util_set_error_from_errno (error, errno);
-  return fd;
-}
-
 void
 ot_util_fatal_literal (const char *msg)
 {
index 59f8ef212f7c9964bf176c8f7e1fd94aeafe986b..ad388ad70d1172bc294f4d75e75c9b9519526366 100644 (file)
@@ -54,12 +54,6 @@ GPtrArray* ot_util_path_split (const char *path);
 
 char *ot_util_path_join_n (const char *base, GPtrArray *components, int n);
 
-int ot_util_count_filename_components (const char *path);
-
-int ot_util_open_file_read (const char *path, GError **error);
-
-int ot_util_open_file_read_at (int dirfd, const char *name, GError **error);
-
 void ot_util_set_error_from_errno (GError **error, gint saved_errno);
 
 G_END_DECLS